package com.ssm.dao;

import com.ssm.Entity.Emp;
import com.ssm.Entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserDAOImpl {

    @Select("select * from user limit #{pyl}, #{pageSize}")
     List<User> selectUser(@Param("pyl") int pyl, @Param("pageSize") int pageSize);

    @Insert("INSERT INTO user (userName, password) VALUES (#{userName}, #{password})")
    int addUser(User user);

    @Select("SELECT userId FROM user WHERE userName = #{userName} AND password = #{password}")
    int userLogin(User user);

    @Select("SELECT * FROM user WHERE userId = #{userId}")
    User findUserById(int userId);

    @Select("select count(*) from user")
    int getTotal();
}
